package com.fc.h5dispaly.h5display.viewpager;

import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.View;

/**
 * Created by fc on 2020/5/12
 * Describe:
 *
 * @author fc
 */

public class CustomTransformer implements ViewPager.PageTransformer {
    private final float offset = 0.8f;
    @Override
    public void transformPage(View page, float position) {
        int width = page.getWidth();
        Log.e((String) page.getTag(), position + "");
        if (position < -1) {
            page.setScrollX((int) (width * offset * -1));
        } else if (position <= 1) {
            if (position < 0) {
                page.setScrollX((int) (width * offset * position));
            } else {
                page.setScrollX((int) (width * offset * position));
            }
        } else {
            page.setScrollX((int) (width * offset));
        }
    }
}